package com.twu.biblioteca;

import java.util.HashMap;

/**
 * Created by Janu on 21/06/14.
 * Class: Option Invoker
 */
public class OptionInvoker {

    private HashMap<String, Option> optionMap = new HashMap<String, Option>();

    public OptionInvoker(OptionManager optionManager){

        optionMap.put(CustomerMenu.LIST_BOOKS.name(), new ListBooks(optionManager));
        optionMap.put(CustomerMenu.LIST_MOVIES.name(), new ListMovies(optionManager));
        optionMap.put(CustomerMenu.CHECK_OUT_BOOK.name(), new CheckOutBook(optionManager));
        optionMap.put(CustomerMenu.RETURN_BOOK.name(), new ReturnBook(optionManager));
        optionMap.put(CustomerMenu.CHECK_OUT_MOVIE.name(), new CheckOutMovie(optionManager));
        optionMap.put(CustomerMenu.RETURN_MOVIE.name(), new ReturnMovie(optionManager));
        optionMap.put(CustomerMenu.CUSTOMER_INFORMATION.name(), new Customer(optionManager));

    }

    public String invoke(CustomerMenu option, Customer customer){
       return optionMap.get(option.name()).doSomething(customer);
    }
}
